<?php

namespace app\common\validate\business;

use think\Validate;

class Business extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'mobile' => ['require', 'regex:/^1[3456789]{1}\d{9}$/', 'unique:business'],
        'password' => ['require'],
        'salt' => ['require'],
        'sourceid' => ['require'],
        'nickname' => ['require'],
        'email' => ['require', 'email']
    ];

    /**
     * 提示消息
     */
    protected $message = [
        'mobile.require' => '手机号必填',
        'mobile.regex' => '手机号格式错误',
        'mobile.unique' => '手机号已注册',
        'password.require' => '密码必填',
        'salt.require' => '密码盐未知',
        'nickname.require' => '昵称必填',
        'email.require' => '邮箱必填',
        'email.email' => '邮箱格式错误',
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'register' => ['mobile', 'password', 'salt'],
        'profile' => ['nickname', 'email'],
    ];

}